﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using F2Enum.Library;
using F2Enum.TestApp.Lib;
using System.Diagnostics;
using System.Threading;

namespace F2Enum.TestApp
{
    public class MainProgram
    {
        public IList<MapperClass<TestClass>> Mappings { get; set; }
        public MainProgram()
        {
            Mappings = new List<MapperClass<TestClass>>();
            Mappings.Add(new MapperClass<TestClass>(e => e.TestClass1.TestClass1.Champ1, 1, 10));
            Mappings.Add(new MapperClass<TestClass>(e => e.TestClass1.TestClass1.Champ2, 1, 10));
        }

        public int GetInstanceNumber(string Pathfile)
        {
            int i = 0;
            F2EnumLibrary.ConvertToObjectsWidthActions(Pathfile, Mappings,
                (t) =>
                {
                    Interlocked.Increment(ref i);
                }
                );
            return i;
        }
        public IEnumerable<TestClass> GetEnumTestClass(string Pathfile)
        {
            return F2EnumLibrary.ConvertToEnumerable(Pathfile, Mappings).ToList();
        }
    }
}
